package com.lianrui.message;

import javax.transaction.SystemException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.lianrui.core.AbstractMessageFactory;


/**
 * 功能描述：系统消息类工厂
 *
 * @author LJQ
 *
 * 2015年12月31日 上午9:14:19
 */
public final class SystemMessageFactory extends AbstractMessageFactory {

	private static final Logger LOGGER = LoggerFactory.getLogger(SystemMessageFactory.class);
	
	private static SystemMessageFactory INSTANCE;
	
	@Override
	public Logger getLogger() {
		return LOGGER;
	}
	
	/**
	 * 功能描述：单例模式
	 * @return
	 * @throws SystemException
	 */
	public static final SystemMessageFactory getInstance() {
		if (INSTANCE == null) {
			INSTANCE = new SystemMessageFactory();
		}
		return INSTANCE;
	}
	
	public static String formatMessage(int key, Object... params) {
		return getInstance().handleMessage(key, params);
	}
	
	public static String formatMessage(String key, Object... params) {
		return getInstance().handleMessage(key, params);
	}
	
	public static String[] formatMessages(String key) {
		return getInstance().handleMessages(key);
	}
}
